<input type="text" name="kw" id="kw" maxlength="100" tabindex="1"
value="{$smarty.post.kw|default:''}" />
<input type="submit" value="搜索" id="su" class="btn"
onmousedown="this.className='btn btn_h'"
onmouseout="this.className='btn'" tabindex="2" />
<!--
autocomplete="off"
<ul>
{  foreach from=$data item=item}
<li><a href="{ $item['link']}">{ $item['title']} &nbsp;
{ $item['pubDate']}</a></li> { /foreach}
</ul>
-->
<table id="tbl_se_list"></table>
<div id="pager_se_list"></div>
<table id="list3"></table>
<div id="pager3"></div>
<script type="text/javascript">
	/*
	 jQuery("#list3").jqGrid('getRowData',jQuery("#list3").jqGrid('getGridParam','selrow'))
	 jQuery("#list3").jqGrid('getGridParam','selarrrow')

	 $("#list3").jqGrid('getPostData');
	 jQuery("#list3").jqGrid('hideCol',["source"]);

	 $("#list3").jqGrid('getGridParam')
	 $("#list3").jqGrid('setGridParam',{ 'postData':{ 'kw':"春涛乡"}}).trigger("reloadGrid");
	 jQuery("#list").jqGrid('setGridParam',{ url:"AJAX/JSON/json_member_mail_sent.aspx?message_mask="+message_mask,page:1}).trigger("reloadGrid");
	 jQuery("#list").jqGrid().setGridParam({ url : 'newUrl'}).trigger("reloadGrid")
	 */
	jQuery(document).ready(function() {
		jQuery("#list3").jqGrid({
			url : '{$smarty.const.BAOGG_BASE_URL}microblog/widget/get-json/widget_id/se_search',
			datatype : "json",
			multiselect : true,
			height : 'auto',
			autowidth : true,
			rownumbers : true,
			gridview : true,
			colNames : ['id', 'title', 'title2', 'pubDate', 'source', 'link', 'description'],
			colModel : [{
				name : 'id',
				index : 'id',
				width : 60,
				sorttype : "int"
			}, {
				name : 'title',
				index : 'title',
				hidden : true
			}, {
				name : 'title2',
				index : 'title2',
				width : 400,
				formatter : function(value, options, rData) {
					return "<a href='" + rData['link'] + "' title='" + rData['description'] + "'>" + rData['title'] + " </a> ";
				}
			}, {
				name : 'pubDate',
				index : 'pubDate',
				width : 80
			}, {
				name : 'source',
				index : 'source',
				width : 120,
				align : "right",
				sorttype : "float"
			}, {
				name : 'link',
				index : 'link',
				width : 120,
				align : "right",
				sorttype : "float",
				hidden : true
			}, {
				name : 'description',
				index : 'description',
				width : 120,
				align : "right",
				sorttype : "float",
				hidden : true
			}],
			rowNum : 20,
			rowList : [20, 30, 50, 100],
			pager : '#pager3',
			grouping : true,
			groupingView : {
				groupField : ['pubDate'],
				groupOrder : ['desc'],
				groupColumnShow : [false]
			},
			jsonReader : {
				repeatitems : false,
				id : "0"
			},
			//sortname : 'pubDate',
			//sortorder : "desc",
			viewrecords : true,
			//loadonce : true,
			toolbar : [true, "top"],
			caption : "Load Once Example"
		});
		$("#t_list3").append("<input id='se_search_doc' type='button' value='word' style='height:20px;font-size:-3'/>");
		$("#se_search_doc").click(function() {
			$.ajax({
				type : "POST",
				url : "{$smarty.const.BAOGG_BASE_URL}microblog/export/doc/widget_id/se_search",
				data : {
					file_content : $.map( jQuery("#list3").jqGrid('getGridParam','selarrrow'), function(i){
					var rData=jQuery("#list3").jqGrid('getRowData',i);
					return  "<a href='"+rData['link']+"' title='"+$('<div/>').text(rData['description']).html()+"'>"+rData['title'] + " </a> "; }).join("<br />"),
					'kw' : $("#kw").val()
				},
				success : function(msg) {
					$('body').append($('<iframe src="' + msg + '" frameBorder="0" width="0" height="0"  style="display:none;visibility:hidden;height:0px;width:0px;">'));
				}
			});
		});
		$("#t_list3").append("<input id='se_search_xls' type='button' value='Excel' style='height:20px;font-size:-3'/>");
		$("#se_search_xls").click(function() {
			$.ajax({
				type : "POST",
				url : "{$smarty.const.BAOGG_BASE_URL}microblog/export/xls/widget_id/se_search",
				data : {
					file_content : $.map( jQuery("#list3").jqGrid('getGridParam','selarrrow'), function(i){
					var rData=jQuery("#list3").jqGrid('getRowData',i);
					return  "<tr><td><a href='"+rData['link']+"' title='"+$('<div/>').text(rData['description']).html()+"'>"+rData['title'] + " </a> </td></tr>"; }).join(""),
					'kw' : $("#kw").val()
				},
				success : function(msg) {
					$('body').append($('<iframe src="' + msg + '" frameBorder="0" width="0" height="0"  style="display:none;visibility:hidden;height:0px;width:0px;">'));
				}
			});
		});
		$("#t_list3").append("<input id='se_search_zip' type='button' value='Zip' style='height:20px;font-size:-3'/>");
		$("#se_search_zip").click(function() {
			$.ajax({
				type : "POST",
				url : "{$smarty.const.BAOGG_BASE_URL}microblog/export/zip/widget_id/se_search",
				data : {
					file_content : JSON.stringify($.map(jQuery("#list3").jqGrid('getGridParam', 'selarrrow'), function(i) {
						var rData = jQuery("#list3").jqGrid('getRowData', i);
						return {
							'link' : rData['link'],
							'title' : rData['title']
						};
					})),
					'kw' : $("#kw").val()
				},
				success : function(msg) {
					$('body').append($('<iframe src="' + msg + '" frameBorder="0" width="0" height="0"  style="display:none;visibility:hidden;height:0px;width:0px;">'));
				}
			});
		});
		
		$("#t_list3").append("<input id='se_search_email' type='button' value='Email' style='height:20px;font-size:-3'/>");
		$("#se_search_email").click(function() {
			$.ajax({
				type : "POST",
				url : "{$smarty.const.BAOGG_BASE_URL}microblog/email/send/widget_id/se_search",
				data : {
					file_content : JSON.stringify($.map(jQuery("#list3").jqGrid('getGridParam', 'selarrrow'), function(i) {
						var rData = jQuery("#list3").jqGrid('getRowData', i);
						return {
							'link' : rData['link'],
							'title' : rData['title']
						};
					})),
					'kw' : $("#kw").val()
				},
				success : function(msg) {
					//$('body').append($('<iframe src="' + msg + '" frameBorder="0" width="0" height="0"  style="display:none;visibility:hidden;height:0px;width:0px;">'));
					alert(msg);
				}
			});
		});
		
		$('#su').click(function() {
			$("#list3").jqGrid('setGridParam',{ 'postData':{ 'kw':$("#kw").val()}}).trigger("reloadGrid");
		});
	});

</script>